<?php

// +----------------------------------------------------------------------
// | TAODUDU.COM  [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.taodudu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: ubten <462193409@qq.com> http://www.ubten.com/
// +----------------------------------------------------------------------

namespace Admin\Controller;
use Think\Controller;
use Libs\Logs;

class LoginController extends Controller {

    //管理员登陆
    public function index() {
        
        layout(FALSE);
        $this->display();
    }

    //登录验证
    public function do_login() {
        $user_object = D('Member');
        $res = $user_object->login(I('username'), I('password'));
        if ($res) {
            $logobj = new Logs();
            $logobj->write(array("管理员:".session('manager_auth.truename'),"登陆",'登陆网站系统后台'));
            $this->success('登陆中……',U('Index/index'));
        }
    }

    public function loginOut() {
        session('manager_id', null);
        session('manager_auth', null);
        $a['status'] = 1;
        $a['msg'] = '退出成功!';
        $this->ajaxReturn($a);
    }

}
